const initRouterInterceptor = (vm) => {
	let list = ["navigateTo", "redirectTo", "reLaunch", "switchTab"];

	// 路由跳转时触发
	list.forEach(item => {
		uni.addInterceptor(item, {
			invoke(e) {
				return e
			},
			fail(err) {
				console.log(err)
			}
		})
	})
}

const getSystemInfo = (vm) => {
	uni.getSystemInfo({
		success: function(e) {
			vm.$u.vuex('systemInfo', e)
		}
	})
}


export default function(vm) {
	//自定义路由拦截
	initRouterInterceptor(vm)
	
	// 获取系统信息
	getSystemInfo(vm)
}
